var a = getApp();

Page({
    data: {
        active: 0,
        accumulate_reward: "--",
        member: {},
        recordsList: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(a) {
        this.getData();
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.salesman-dividend.frontend.reward-log.get-reward-list");
        a._postNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    member: e.data.memberInfo,
                    accumulate_reward: e.data.accumulate_reward,
                    total_page: e.data.list.last_page,
                    recordsList: e.data.list.data,
                    isLoadMore: !0
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getMoreData: function() {
        var t = this, e = a.getNetAddresss("plugin.salesman-dividend.frontend.reward-log.get-reward-list");
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page++;
            var o = {
                page: this.data.page
            };
            a._getNetWork({
                url: e,
                data: o,
                success: function(a) {
                    var e = a.data;
                    if (1 == e.result) {
                        t.data.isLoadMore = !0;
                        var o = e.data.list.data;
                        t.setData({
                            recordsList: t.data.recordsList.concat(o)
                        });
                    } else t.data.isLoadMore = !1, t.data.page--;
                }
            });
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});